#include <iostream>
#include <cmath>
#include "linkedlist.h"
using namespace std;

int main()
{
    int num = 0;
    cin >> num;

    // 首先求出数字的位数
    int digit = 0;
    int temp = num;
    while (temp != 0)
    {
        temp /= 10;
        digit++;
    }

    // 创建一个链表
    LinkedList list;
    // 把数字的每一位放入链表中
    for (int i = digit; i > 0; i--)
    {
        int temp = pow(10, i - 1);
        int digit_num = num / temp;
        list.insert(digit_num);
        num -= digit_num * temp;
    }
    Node *current = list.head;
    Node *move = list.head;
    // 从第一位数字开始，依次走下去
    for (int i = 0; i < digit; i++)
    {
        current->visited = true;
        for (int j = 0; j < current->data; j++)
        {
            move = move->next;
        }
        current = move;
    }

    // 如果走到了第一位，且每一个数字都被访问过了，说明是runaround数
    Node *visit = list.head;
    bool is_runaround = true;
    for (int i = 0; i < digit; i++)
    {
        if (visit->visited == false)
        {
            is_runaround = false;
            break;
        }
        visit = visit->next;
    }

    if (current == list.head && is_runaround)
    {
        cout << "yes" << endl;
    }
    else
    {
        cout << "no" << endl;
    }
    return 0;
}